package sample;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@XmlRootElement(name = "game")
public class WrapperMagicSquare {

    @XmlElement(name = "hasConstrain")
    private boolean hasConstrain;
    @XmlTransient
    public void setHasConstrain(boolean hasConstrain){
        this.hasConstrain = hasConstrain;
    }

    public boolean getConstrain(){
        return hasConstrain;
    }


    @XmlElement(name = "generation")
    private int generation;

    @XmlTransient
    public void setGeneration(int generation){
        this.generation = generation;
    }

    public int getGeneration(){
        return generation;
    }

    @XmlElement(name = "dimension")
    private int dimension;

    @XmlTransient
    public void setDimension(int dimension){
        this.dimension = dimension;
    }

    public int getDimension(){
        return dimension;
    }


    @XmlElement(name = "grid")
    private int[][] grid;
    @XmlTransient
    public void setGrids(int[][] grid){
        this.grid = new int[dimension+1][dimension+1];
        for (int i=1;i<=dimension;i++){
            for (int j = 1;j <= dimension;j ++){
                this.grid[i][j] = grid[i][j];
            }
        }
    }

    public int[][] getGrids(){
        int[][] grid = new int[dimension+1][dimension+1];
        for(int i = 1;i <= dimension;i ++){
            for (int j = 1;j <= dimension;j ++){
                grid[i][j] = this.grid[i][j];
            }
        }
        return grid;
    }

    @XmlElement(name = "isFixed")
    private boolean[][] isFixed;
    @XmlTransient
    public void setIsFixed(boolean[][] isFixed){
        this.isFixed = new boolean[dimension+1][dimension+1];
        for (int i=1;i<=dimension;i++){
            for (int j = 1;j <= dimension;j ++){
                this.isFixed[i][j] = isFixed[i][j];
            }
        }
    }

    public boolean[][] getIsFixed(){
        boolean[][] isFixed = new boolean[dimension+1][dimension+1];
        for(int i = 1;i <= dimension;i ++){
            for (int j = 1;j <= dimension;j ++){
                isFixed[i][j] = this.isFixed[i][j];
            }
        }return isFixed;
    }

}
